function closes() {
    window.close();
}
function add(index,opt) {
    let price1 = window.document.getElementsByName("price");
    let amount1 = window.document.getElementsByName("amount");
    if(opt == "+") {
        amount1[index].value = parseInt(amount1[index].value) + 1;
    }else if(opt == "-" && amount1[index].value > 1) {
        amount1[index].value = parseInt(amount1[index].value) - 1;
    }
    let sum1 = parseFloat(price1[index].value) * parseInt(amount1[index].value);
    let price0 = window.document.getElementById("price" + index);
    price0.innerText = "¥" + sum1;
    sumall();
}
// function add1() {
//     let price1 = window.document.getElementsByName("price");
//     let amount1 = window.document.getElementsByName("amount");
//     amount1[1].value = parseInt(amount1[1].value) + 1;
//     sum0 = parseFloat(price1[1].value) * parseInt(amount1[1].value);
//     let price0 = window.document.getElementById("price0");
//     price0.innerText = "¥" + sum0;
//     sumall();
// }
function relise() {
    let price1 = window.document.getElementsByName("price");
    let amount1 = window.document.getElementsByName("amount");
    if (amount1[0].value > 1) {
        amount1[0].value = parseInt(amount1[0].value) - 1;
        sum2 = parseFloat(price1[0].value) / parseInt(amount1[0].value);
        let price1 = window.document.getElementById("price1");
        price1.innerText = "¥" + sum2;
        sumall();
    }
}
// function relise1() {
//     let price1 = window.document.getElementsByName("price");
//     let amount1 = window.document.getElementsByName("amount");
//     if(amount1[1].value > 1){
//         amount1[1].value = parseInt(amount1[0].value) - 1;
//         sum3 = parseFloat(price1[1].value) / parseInt(amount1[1].value);
//         let price1 = window.document.getElementById("price1");
//         price1.innerText = "¥" + sum3;
//         sumall();
//     }

    function sumall() {
        let price0 = window.document.getElementById("price0");
        let sumall1 = price0.innerText.substring(1);
        let price1 = window.document.getElementById("price1");
        let sumall2 = price1.innerText.substring(1);
        let sum5 = parseFloat(sumall1) + parseFloat(sumall2);
        window.document.getElementById("totalPrice").innerText = "¥" + sum5;

    }